package com.sss.springcloud.controller;

import com.sss.springcloud.service.PaymentService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author sss
 * @date 2020-03-07 14:21
 **/
@RestController
public class PaymentController {
    @Resource
    private PaymentService paymentService;
    @Value("${server.port}")
    private String  server_port;

    @GetMapping("/payment/hystrix/ok/{id}")
    public String ok(@PathVariable Integer id){
        String ok = paymentService.paymentInfo_ok(id);
        return  ok;
    }

    @GetMapping("/payment/hystrix/timeout/{id}")
    public String timeout(@PathVariable Integer id){
        String timeout = paymentService.paymentInfo_timeout(id);
        System.out.println("*********"+timeout);
        return  timeout;

    }
    @GetMapping("/payment/hystrix/circuit/{id}")
    public String circuit(@PathVariable("id") Integer id){
        String timeout = paymentService.paymentCircuitBreaker(id);
        return  timeout;

    }
}
